package com.yjq.yys.yhCalculate.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

@Getter
@AllArgsConstructor
public enum BuffSortEnum {

    DEFENCE_RATE(1, "defence_rate"),
    HEALTH_POINT_RATE(2, "health_point_rate"),
    ATTACK_RATE(3, "attack_rate"),
    CRIT_RATE(4, "crit_rate"),
    EFFECT_AVOID(5, "effect_avoid"),
    EFFECT_HIT(6, "effect_hit"),
    VELOCITY(7, "velocity"),
    CRIT_DAMAGE(8, "crit_damage"),
    ATTACK(9, "attack"),
    DEFENCE(10, "defence"),
    HEALTH_POINT(11, "health_point");

    private Integer index;
    private String name;

    public static BuffSortEnum getSortByIndex(Integer index){
        for(BuffSortEnum buffSortEnum : BuffSortEnum.values()){
            if(buffSortEnum.index.equals(index)){
                return buffSortEnum;
            }
        }
        return null;
    }

    public static Integer getIndexByName(String name){
        for(BuffSortEnum buffSortEnum : BuffSortEnum.values()){
            if(buffSortEnum.name.equals(name)){
                return buffSortEnum.index;
            }
        }
        return null;
    }

}
